<!--
 * @Author: yaojian66 1327629137@qq.com
 * @Date: 2022-06-27 19:15:43
 * @LastEditors: yaojian66 1327629137@qq.com
 * @LastEditTime: 2022-06-27 19:18:51
 * @FilePath: \geyao\第七十六题 返回文件扩展名.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>返回文件扩展名</title>
</head>

<body>
  <!-- 请补全JavaScript代码，要求以字符串的形式返回文件名扩展名，文件名参数为"filename"。 -->
  <script>
    const _getExFilename = (filename) => {
      // 补全代码
      let lastindex = filename.lastIndexOf('.')
      return filename.slice(0, lastindex) && lastindex !== -1 ? filename.slice(lastindex) : ''
    }
  </script>

</body>

</html>